import { CoolConfig, MODETYPE } from '@cool-midway/core';
import { MidwayConfig } from '@midwayjs/core';
// import * as fsStore from '@cool-midway/cache-manager-fs-hash';
import * as redisStore from 'cache-manager-ioredis';

export default {
  // use for cookie sign key, should change to your own and keep security
  keys: 'cool-admin for node',
  koa: {
    port: 8001,
  },
  // 模板渲染
  view: {
    mapping: {
      '.html': 'ejs',
    },
  },
  // 文件上传
  upload: {
    fileSize: '200mb',
    whitelist: null,
  },
  // 本地缓存
  // cache: {
  //   store: fsStore,
  //   options: {
  //     path: 'cache',
  //     ttl: -1,
  //   },
  // },
  // redis缓存
  cache: {
    store: redisStore,
    options: {
      host: '127.0.0.1',
      port: 6379,
      password: '',
      db: 1,
      ttl: null,
    },
  },
  // cool配置
  cool: {
    redis: {
      host: '127.0.0.1',
      port: 6379,
      password: '',
      db: 0,
    },
    file: {
      // 上传模式 本地上传或云存储 LOCAL 本地 CLOUD 云存储
      mode: MODETYPE.CLOUD,
      // 云存储配置
      cos: {
        accessKeyId: 'AKIDZ0EF3dzBANMJF6lGYfdOuEKEwcPyJWaT',
        accessKeySecret: '123456',
        bucket: 'oss-1257486725',
        region: 'ap-guangzhou',
        publicDomain: 'https://oss-1257486725.cos.ap-guangzhou.myqcloud.com',
      },
      // 本地上传 文件地址前缀
      domain: 'http://127.0.0.1:8001',
    },
  } as CoolConfig,
} as MidwayConfig;
